package com.an.vhr.service;

import com.an.vhr.bean.Department;
import com.an.vhr.mapper.DepartmentMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: an1089
 **/
@Service
public class DepartmentService {
    @Resource
    DepartmentMapper departmentMapper;

    public List<Department> getAllDepartmentsByParentId(Integer pid) {
        return departmentMapper.getAllDepartmentsByParentId(pid);
    }

    public void addDep(Department department) {
        department.setEnabled(true);
        departmentMapper.addDep(department);
    }

    public void deleteDepById(Department department) {
        departmentMapper.deleteDepById(department);
    }

    public List<Department> getAllDepartmentsWithNoChildren() {
        return departmentMapper.getAllDepartmentsWithNoChildren();
    }
}
